const express = require('express');
const router = express.Router();
const userRouter = require('../router_handler/user');
const middleUsers = require('../middleware/middleUsers');


/* GET users listing. */
router.get('/', function(req, res, next) {
  res.send('respond with a resource');
});

// hello接口
router.get('/hello',(req,res)=>{
  console.log(typeof(req.query))
  if(JSON.stringify(req.query)=="{}"){
    return res.cc("无参数",1);
  }else{
    res.send({
    status:200,
    msg:req.query,
  });
  }
});

// 登录模块
router.post('/login',middleUsers.mw1,middleUsers.mw2,userRouter.login);
// 注册用户名模块
router.post('/registerUser',middleUsers.registerDeleted,userRouter.registerUser);
module.exports = router;
